function check(str,reg){
	var objExp=new RegExp(reg);
	if(objExp.test(str)==true){
		return true;
	}else{
		return false;
	}
}

function chkreg(form,label){
	if(label=='name' || label=="all"){
		if(!check(form.name.value,/^[\w|\W]{1,20}$/g))
		{
			check_name.innerHTML="姓名长度不正确！";
			form.name.style.backgroundColor="#F1B000";
			//check_name.style.display="block";
			$('#check_name').slideDown('fast');
			return false;
		}
		form.name.style.backgroundColor="#FFFFFF";
		//check_name.style.display="none";
		$('#check_name').slideUp('fast');
	}

	if(label=='id' || label=="all"){
		if(!check(form.id.value,/^(\d{17}[\d|x|X]{1})?$/g))
		{
			check_id.innerHTML="身份证号不正确！";
			form.id.style.backgroundColor="#F1B000";
			//check_id.style.display="block";
			$('#check_id').slideDown('fast');
			return false;
		}
		form.id.style.backgroundColor="#FFFFFF";
		$('#check_id').slideUp('fast');
		//check_id.style.display="none";
	}

	if(label=='qq' || label=="all"){
		if(!check(form.qq.value,/^(\d{5,11})?$/g))
		{
			check_qq.innerHTML="QQ号格式不正确！";
			form.qq.style.backgroundColor="#F1B000";
			//check_qq.style.display="block";
			$('#check_qq').slideDown('fast');
			return false;
		}
		form.qq.style.backgroundColor="#FFFFFF";
		$('#check_qq').slideUp('fast');
		//check_qq.style.display="none";
	}


	if(label=='email' || label=="all"){
		if(!check(form.email.value,/^(\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)?$/))
		{
			check_email.innerHTML="Email格式不正确！";
			form.email.style.backgroundColor="#F1B000";
			//check_email.style.display="block";
			$('#check_email').slideDown('fast');
			return false;
		}
		form.email.style.backgroundColor="#FFFFFF";
		$('#check_email').slideUp('fast');
		//check_email.style.display="none";
	}

	if(label=='contacts' || label=="all"){
		if(!check(form.contacts.value,/^(1\d{10})?$/))
		{
			check_contacts.innerHTML="手机号格式不正确！";
			form.contacts.style.backgroundColor="#F1B000";
			//check_contacts.style.display="block";
			$('#check_contacts').slideDown('fast');
			return false;
		}
		form.contacts.style.backgroundColor="#FFFFFF";
		//check_contacts.style.display="none";
		$('#check_contacts').slideUp('fast');
	}
}

function setPassword()
{
	$(window.parent.document).find("h3:first").html('修改密码');
	location.href='./password.jsp';
}

function myformatter(date){
    var y = date.getFullYear();
    var m = date.getMonth()+1;
    var d = date.getDate();
    return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
function myparser(s){
    if (!s) return new Date();
    var ss = (s.split('-'));
    var y = parseInt(ss[0],10);
    var m = parseInt(ss[1],10);
    var d = parseInt(ss[2],10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
        return new Date(y,m-1,d);
    } else {
        return new Date();
    }
}


